#include <REGX52.H>

unsigned int T0_count = 0;
unsigned int T1_count = 0;

void timer0_init()
{
	TMOD = TMOD & 0xF0;//
	TMOD = TMOD | 0x01;
	TF0 = 0;
	TR0 = 1;
	TH0 = 0xFC;
	TL0 = 0x66;
	ET0 = 1;
	PT0 = 0;
	EA = 1;
}


void timer1_init()
{
	TMOD = TMOD & 0x0F;//
	TMOD = TMOD | 0x10;
	TF1 = 0;
	TR1 = 1;
	TH1 = 0xFC;
	TL1 = 0x66;
	ET1 = 1;
	PT1 = 0;
}

void main()
{
	P2_0 = 0;
	P2_1 = 1;
	timer0_init();
	timer1_init();
	while(1)
	{
		
	
	}
	
}

void timer1_exit() interrupt 3
{
	T1_count++;
	if(T1_count >= 1000)
	{
		P2_1 = ~P2_1;
		T1_count = 0;
	}
	TH1 = 0xFC;
	TL1 = 0x66;
}

void timer0_exit() interrupt 1
{
	T0_count++;
	if(T0_count >= 1000)
	{
		P2_0 = ~P2_0;
		T0_count = 0;
	}
	TH0 = 0xFC;
	TL0 = 0x66;
}
